<?php

namespace App\Http\Controllers\Admin\Orders;

use App\Http\Controllers\Controller as BaseController;
use App\Repository\Orders\OrdersLabelRepository;
use Illuminate\Http\Request;

// 专门标签
class LabelController extends BaseController
{
    private $repoist;

    public function __construct(OrdersLabelRepository $repository)
    {
        $this->repoist = $repository;
    }

    public function index(Request $request)
    {
        return $this->repoist->index($request->all(), $request->get('pageNum'), $request->get('pageSize'));
    }

    public function edit(Request $request)
    {
        return $this->repoist->edit($request->all());
    }

    public function del(Request $request, $id)
    {
        if (!$id) {
            return $this->returnMsg(1, '请传递参数');
        }
        return $this->repoist->del($id);
    }

    public function add(Request $request)
    {
        if (!$request->get('name')) {
            return $this->returnMsg(1, '标签名字不能为空');
        }
        return $this->repoist->add($request->all());
    }

}
